/**
 * 需求创建/编辑表单页面样式
 * 提供清晰的表单布局和良好的用户体验
 */

/* 表单容器 */
.requirement-form {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

/* 表单分组 */
.form-section {
    padding: 2rem;
    border-bottom: 1px solid #e9ecef;
    position: relative;
}

.form-section:last-child {
    border-bottom: none;
}

/* 分组头部 */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #f8f9fa;
}

.section-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #2c3e50;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.section-title i {
    color: #3498db;
}

/* 分组标签 */
.section-badge {
    font-size: 0.75rem;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.section-badge.required {
    background: #e74c3c;
    color: white;
}

.section-badge.optional {
    background: #95a5a6;
    color: white;
}

/* 必填字段标识 */
.required-field::after {
    content: ' *';
    color: #e74c3c;
    font-weight: bold;
}

/* 表单控件增强 */
.form-control:focus,
.form-select:focus {
    border-color: #3498db;
    box-shadow: 0 0 0 0.2rem rgba(52, 152, 219, 0.25);
}

.form-control.is-invalid,
.form-select.is-invalid {
    border-color: #e74c3c;
    box-shadow: 0 0 0 0.2rem rgba(231, 76, 60, 0.25);
}

.form-control.is-valid,
.form-select.is-valid {
    border-color: #27ae60;
    box-shadow: 0 0 0 0.2rem rgba(39, 174, 96, 0.25);
}

/* 文档管理区域 */
.documents-container {
    min-height: 200px;
}

.documents-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.document-item {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 1rem;
    transition: all 0.3s ease;
    position: relative;
}

.document-item:hover {
    border-color: #3498db;
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.15);
}

.document-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.5rem;
}

.document-title {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 0.25rem;
}

.document-type {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.document-type.type-specification {
    background: #3498db;
    color: white;
}

.document-type.type-design {
    background: #9b59b6;
    color: white;
}

.document-type.type-prototype {
    background: #e67e22;
    color: white;
}

.document-type.type-reference {
    background: #27ae60;
    color: white;
}

.document-type.type-other {
    background: #95a5a6;
    color: white;
}

.document-description {
    color: #6c757d;
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
    line-height: 1.4;
}

.document-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: #6c757d;
}

.document-actions {
    display: flex;
    gap: 0.5rem;
}

.document-actions .btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

/* 空状态 */
.no-documents {
    text-align: center;
    padding: 3rem 1rem;
    color: #6c757d;
}

.no-documents i {
    color: #bdc3c7;
    margin-bottom: 1rem;
}

/* 表单操作区域 */
.form-actions {
    background: #f8f9fa;
    padding: 1.5rem 2rem;
    margin-top: 2rem;
    margin-bottom: 2rem;
    border-top: 1px solid #e9ecef;
    border-radius: 0 0 12px 12px;
}

/* 右侧信息面板 */
.info-panel {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    position: sticky;
    top: 100px;
}

.panel-section {
    padding: 1.5rem;
    border-bottom: 1px solid #e9ecef;
}

.panel-section:last-child {
    border-bottom: none;
}

.panel-title {
    font-size: 1rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.panel-title i {
    color: #3498db;
}

/* 状态信息 */
.status-info {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.status-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid #f8f9fa;
}

.status-item:last-child {
    border-bottom: none;
}

.status-label {
    font-size: 0.9rem;
    color: #6c757d;
    font-weight: 500;
}

.status-value {
    font-size: 0.9rem;
    color: #2c3e50;
    font-weight: 600;
}

/* 提示列表 */
.tips-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.tip-item {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    font-size: 0.85rem;
    line-height: 1.4;
}

.tip-item i {
    margin-top: 0.1rem;
    flex-shrink: 0;
}

/* 快捷操作 */
.quick-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* 模态框增强 */
.modal-header {
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
}

.modal-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.modal-title i {
    color: #3498db;
}

/* 预览内容 */
.preview-section {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #e9ecef;
}

.preview-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.preview-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.preview-content {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
    border-left: 4px solid #3498db;
}

.preview-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.preview-meta-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.preview-meta-label {
    font-size: 0.85rem;
    color: #6c757d;
    font-weight: 500;
}

.preview-meta-value {
    font-size: 0.9rem;
    color: #2c3e50;
    font-weight: 600;
}

/* 加载遮罩 */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(2px);
}

.loading-content {
    text-align: center;
    color: #2c3e50;
}

.loading-content .spinner-border {
    width: 3rem;
    height: 3rem;
}

/* 动画效果 */
.fade-in {
    animation: fadeIn 0.3s ease-in;
}

.slide-in {
    animation: slideIn 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* 表单验证状态 */
.form-validation-summary {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.validation-error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.validation-success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .form-section {
        padding: 1.5rem;
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .form-actions {
        padding: 1rem 1.5rem;
        margin-top: 1.5rem;
        margin-bottom: 1.5rem;
    }
    
    .form-actions .d-flex {
        flex-direction: column;
        gap: 1rem;
    }
    
    .form-actions .d-flex > div {
        display: flex;
        gap: 0.5rem;
    }
    
    .info-panel {
        position: static;
        margin-top: 2rem;
    }
    
    .panel-section {
        padding: 1rem;
    }
    
    .document-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .document-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .preview-meta {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 576px) {
    .form-section {
        padding: 1rem;
    }
    
    .form-actions {
        padding: 1rem;
        margin-top: 1rem;
        margin-bottom: 1rem;
    }
    
    .panel-section {
        padding: 0.75rem;
    }
    
    .no-documents {
        padding: 2rem 0.5rem;
    }
    
    .document-actions {
        flex-direction: column;
        width: 100%;
    }
    
    .document-actions .btn {
        width: 100%;
    }
}

/* 打印样式 */
@media print {
    .sidebar,
    .navbar,
    .form-actions,
    .info-panel,
    .modal,
    .toast-container {
        display: none !important;
    }
    
    .main-content {
        margin-left: 0 !important;
        padding-top: 0 !important;
    }
    
    .requirement-form {
        box-shadow: none;
        border: 1px solid #ddd;
    }
    
    .form-section {
        break-inside: avoid;
    }
    
    .document-item {
        break-inside: avoid;
        border: 1px solid #ddd;
        background: white;
    }
}

/* 高对比度模式支持 */
@media (prefers-contrast: high) {
    .form-control,
    .form-select {
        border-width: 2px;
    }
    
    .document-item {
        border-width: 2px;
    }
    
    .section-badge,
    .document-type {
        border: 2px solid currentColor;
    }
}

/* 减少动画模式支持 */
@media (prefers-reduced-motion: reduce) {
    .fade-in,
    .slide-in {
        animation: none;
    }
    
    .document-item,
    .form-control,
    .form-select,
    .btn {
        transition: none;
    }
}